package com.nip.irregularvebsdict.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.nip.irregularvebsdict.R;
import com.nip.irregularvebsdict.utilities.ImageAsyncTask;

public class NIPShowProfiles extends Activity {

	private ImageView imageView;
	private TextView textView;
	private Intent intent;
	private Bundle bundle;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_show_facebook_profiles);

		initialize();

	}

	private void initialize() {

		imageView = (ImageView) findViewById(R.id.imAvatar);
		textView = (TextView) findViewById(R.id.tvFacebookName);

		intent = getIntent();
		bundle = intent.getExtras();

		if (bundle == null) {
			finish();
		}

		textView.setText(bundle.getString(NIPVerbDetailsActivity.NAME_KEY));
		new ImageAsyncTask(imageView).execute(bundle
				.getString(NIPVerbDetailsActivity.IMAGE_LINK_KEY));
	}

	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btnShare:
			setResult(NIPVerbDetailsActivity.RESULT_POST_OK_CODE, intent);
			break;
		case R.id.btnLogout:
			setResult(NIPVerbDetailsActivity.RESULT_POST_ANOTHER_ACCOUNT, intent);
			break;

		default:
			break;
		}

		finish();
	}
}
